package com.db.area.controller;

import com.db.area.dto.AreaPageDto;
import com.db.area.service.AreaService;
import com.db.core.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 作者：Bin
 * 时间：2023/10/28
 * 描述：键盘敲烂，薪资过万
 */
@RestController
@RequestMapping("area")
@CrossOrigin
public class AreaController {

    @Autowired
    private AreaService areaService;

    @PostMapping("page")
    public R page(@RequestBody AreaPageDto areaPageDto){
        return areaService.pageList(areaPageDto);
    }


    @GetMapping("all")
    public R all(){
        return R.ok(areaService.list(),"success") ;
    }

    @GetMapping("cascade")
    public R cascade(){
        return areaService.selectCascadedArea();
    }

}
